# -*- coding: utf-8 -*-
from PyQt5.QtWidgets import *
import sys


class Changed(QWidget):
    def __init__(self):
        super(Changed, self).__init__()

        layout = QHBoxLayout()

        self.label = QLabel("value:")
        layout.addWidget(self.label)

        self.check = QSpinBox()
        layout.addWidget(self.check)
        # valueChanged计数器信号槽，获取计数器当前值并传递
        self.check.valueChanged.connect(self.value)

        self.label1 = QLabel("values: ")
        layout.addWidget(self.label1)

        self.setLayout(layout)

    def value(self):
        self.label1.setText("values:" + str(self.check.value()))

if __name__ == '__main__':
    app = QApplication(sys.argv)
    change = Changed()
    change.show()
    sys.exit(app.exec_())